#include <iostream>

class Event
{
public:
   Event(int e, std::string e_msg): event_(e), event_msg(e_msg) {}  

private:
    int event_;
    std::string event_msg;
};

class ModuleBase
{
public:
    virtual ~ModuleBase() {}  // 必须要有虚析构函数
    virtual void init()  = 0;
    virtual void start() = 0;
    virtual std::string name() = 0;
    virtual std::string version() = 0;

    virtual void processEvent() { std::cout << "event ModuleBase" << std::endl; };
};

class EventDispatch
{
public:
    void SendEvent(ModuleBase *receiver, Event *event) {
        receiver->processEvent();
    }
};

class ModuleA : public ModuleBase
{
    void init()    override { std::cout << "init ModuleA" << std::endl; };
    void start()   override { std::cout << "start ModuleA" << std::endl; };
    std::string name()    override { return "ModuleA"; };
    std::string version() override { return "1.0.0"; };

    void processEvent() { std::cout << "event ModuleA" << std::endl; };
};

int main(void)
{
    std::cout << "enter main" << std::endl;

    ModuleBase *module_ = new ModuleA();
    EventDispatch *eventDispatch = new EventDispatch();
    Event *e = new Event(10000, "test msg");
    eventDispatch->SendEvent(module_, e);

    return 0;
}